import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import 'font-awesome/css/font-awesome.min.css'

router.beforeEach(function(to,from,next){
	let user = sessionStorage.getItem('user');
	//判断路由到哪里去
	//※除了※在登录、注册、首页、商家列表、商家信息以外的组件都需要判断是否登录
	if(!(to.path=='/'||to.path=='/index'||to.path=='/businessList'||
		to.path=='/businessInfo'||to.path=='/login'||to.path=='/register')){
		if(user==null){
			router.push('/login');
		}
	}
	//如果路由守卫通过则继续往下走
	next();
	
});

createApp(App).use(store).use(router).mount('#app')

